package tests;

import Model.ComplexTask;
import Model.SingleTask;
import junit.framework.TestCase;
import org.junit.Test;

/**
 * Unit test for a complex task
 *
 * @author psyomn
 */
public class ComplexTaskTest extends TestCase {

    @Test
    public void testAddTodoItem() throws Exception {
        ComplexTask cxt = new ComplexTask("Name", new java.sql.Date(0), "Complex");
        SingleTask st = new SingleTask("subtask", new java.sql.Date(0), "Single");

        cxt.addTodoItem(st);
        assertTrue(cxt.getTodo().contains(st));
    }

    @Test
    public void testSetTodoItemStatus() throws Exception {
        ComplexTask cxt = new ComplexTask("Name", new java.sql.Date(0), "Complex");
        SingleTask st = new SingleTask("subtask", new java.sql.Date(0), "Single");

        cxt.addTodoItem(st);
        cxt.setTodoItemStatus(0, true);
        assertTrue(cxt.getTodo().get(0).getDone());
    }

    @Test
    public void testGetDone() throws Exception {
        ComplexTask cxt = new ComplexTask("Name", new java.sql.Date(0), "Complex");
        SingleTask st = new SingleTask("subtask", new java.sql.Date(0), "Single");

        cxt.addTodoItem(st);
        cxt.setTodoItemStatus(0, true);
        assertTrue(cxt.getTodo().get(0).getDone());
    }
}
